<?php

/**
 * WebService安全插件
 * @author lcg
 */

class WebServiceSecurity
{
	protected $targetObj = null;
	
	protected $isValidated = false;
	
	function __construct($className)
	{
		$this->targetObj = new $className();	
	}
	
	public function validate($a, $b)
	{
		//if ($a == 1 && $b == 1)
			$this->isValidated = true;
	}
	
	public function __call($methodName, $args)
	{
		try 
		{
			//if ($this->isValidated == false)
				//throw new SunException('非法的请求');
				
			$res = call_user_func_array(array($this->targetObj, $methodName), $args);
		}
		catch (SunException $e)
		{
			return $e->getMessage();
		}
		
		return $res;
	}
	
}

?>